import * as types from '../types'

export default {
  namespaced: true,
  state: {
    params: {},
    showNames: {}
  },
  getters: {
    params: state => state.params,
    showNames: state => state.showNames
  },
  actions: {
    updateFilterParams ({commit, state}, data) {
      commit(types.UPDATE_FILTER_PARAMS, data)
    },
    updateShowNames ({commit, state}, data) {
      commit(types.UPDATE_FILTER_SHOW_NAMES, data)
    },
    reset ({commit, state}, data) {
      commit(types.RESET_FILTER_PARAMS, data)
    }
  },
  mutations: {
    [types.UPDATE_FILTER_PARAMS] (state, payload) {
      state.params = payload
    },
    [types.UPDATE_FILTER_SHOW_NAMES] (state, payload) {
      state.showNames = payload
    },
    [types.RESET_FILTER_PARAMS] (state, payload) {
      state.params = {}
      state.showNames = {}
    }
  }
}
